<template>
  <div class="app-container">
    <!--工具栏-->
    <div class="head-container">
      <div>
        <!-- 搜索 -->
        <el-input v-model="query.akc190" clearable size="small" placeholder="住院编码" style="width: 150px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
        <el-input v-model="query.aac001" clearable size="small" placeholder="个人编码" style="width: 150px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
        <el-input v-model="query.aac003" clearable size="small" placeholder="姓名" style="width: 150px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
        <el-input v-if="roleId !== 10714 && roleId !== 13621" v-model="query.akb020" clearable size="small" placeholder="服务机构编号" style="width: 150px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
        <rrOperation :crud="crud" />
      </div>
      <!--表格渲染-->
      <el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
        <el-table-column type="selection" width="55" />
        <el-table-column prop="aac001" label="个人编号" align="center" width="75px" />
        <el-table-column prop="aac003" label="姓名" align="center" width="70px" />
        <el-table-column v-if="roleId !== 10714 && roleId !== 13621" prop="akb020" label="服务机构编号" align="center" width="100px" />
        <el-table-column v-if="roleId !== 10714 && roleId !== 13621" prop="akb021" label="服务机构名称" align="center" width="300px" />
        <el-table-column prop="aae036" label="结算时间" align="center" width="140px" />
        <el-table-column prop="akc264" label="医疗费总额" align="center" width="90px" />
        <el-table-column prop="akc261" label="个人现金支付" align="center" width="100px" />
        <el-table-column prop="akc255" label="帐户支付金额" align="center" width="100px" />
        <el-table-column prop="akc260" label="统筹支付金额" align="center" width="100px" />
        <el-table-column prop="akc190" label="住院编码" align="center" width="140px" />
      </el-table>
      <!--分页组件-->
      <pagination />
    </div>
  </div>
</template>

<script>
import crudPggs from '@/api/business/pggs'
import CRUD, { presenter, header, crud } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'
import { mapGetters } from 'vuex'

export default {
  name: 'Kc22',
  components: { pagination, crudOperation, rrOperation, udOperation },
  mixins: [presenter(), header(), crud()],
  dicts: ['ccstcqh'],
  cruds() {
    return CRUD({ title: '费用明细', url: 'api/generalQuery/queryKc244', idField: 'id', sort: 'aae036,asc', crudMethod: { ...crudPggs }})
  },
  data() {
    return {
      value2: '',
      roleId: 0,
      akc190: '',
      kc24Dialog: false,
      cblxTypeOptions: [
        { key: '职工', display_name: '职工' },
        { key: '居民', display_name: '居民' }
      ],
      zhlbTypeOptions: [
        { key: '9', display_name: '机构' },
        { key: '10', display_name: '居家' }
      ],
      permission: {
        add: ['admin', 'pggs:add'],
        edit: ['admin', 'pggs:edit'],
        del: ['admin', 'pggs:del']
      },
      rules: {
        bisGsglQymc: [
          { required: true, message: '企业名称不能为空', trigger: 'blur' }
        ],
        bisGsglTyshxydm: [
          { required: true, message: '统一社会信用代码不能为空', trigger: 'blur' }
        ],
        bisGsglLxr: [
          { required: true, message: '联系人不能为空', trigger: 'blur' }
        ],
        bisGsglLxrdh: [
          { required: true, message: '联系人电话不能为空', trigger: 'blur' }
        ],
        bisGsglSsqx: [
          { required: true, message: '所属区县不能为空', trigger: 'blur' }
        ],
        bisGsglZcdz: [
          { required: true, message: '注册地址不能为空', trigger: 'blur' }
        ]
      },
      queryTypeOptions: [
        { key: 'bisGsglQymc', display_name: '企业名称' },
        { key: 'bisGsglTyshxydm', display_name: '统一社会信用代码' },
        { key: 'bisGsglLxr', display_name: '联系人' },
        { key: 'bisGsglLxrdh', display_name: '联系人电话' },
        { key: 'bisGsglSsqx', display_name: '所属区县' },
        { key: 'bisGsglZcdz', display_name: '注册地址' }
      ]
    }
  },
  computed: {
    ...mapGetters([
      'user'
    ])
  },
  methods: {
    // 钩子：在获取表格数据之前执行，false 则代表不获取数据
    [CRUD.HOOK.beforeRefresh]() {
      this.roleId = this.user.roles[0].id
      return true
    }
  }
}
</script>

<style scoped>

</style>
